<template>
	<view>
		<!-- <u-tabbar :list="list" :mid-button="false" active-color="rgb(80, 152, 255)"></u-tabbar> -->
    <u-tabbar
    	:value="tabBarNum"
    	@change="change1"
      :fixed="true"
    	:placeholder="true"
    	:safeAreaInsetBottom="false"
    >
    	<u-tabbar-item :text="item.text" :icon="item.iconPath" v-for="(item,index) in list" :key="index"></u-tabbar-item>
    </u-tabbar>
	</view>
</template>

<script>
  import {
  	mapState,
  	mapMutations
  } from 'vuex'
	export default {
		data() {
			return {
        value1:0,
				list:[{
						iconPath: "home",
						selectedIconPath: "home-fill",
						text: '首页',
						customIcon: false,
						pagePath: "/pages/main/main"
					},
					{
						iconPath: "",
						selectedIconPath: "moments-circel-fill",
						text: '中凯公司',
						customIcon: false,
						pagePath: "/pages/company/index"
					},
					{
						iconPath: "moments",
						selectedIconPath: "moments-circel-fill",
						text: '活动',
						customIcon: false,
						pagePath: "/pages/events/events"
					},
					// {
					// 	iconPath: "file-text",
					// 	selectedIconPath: "file-text-fill",
					// 	text: '借书',
					// 	count: 2,
					// 	isDot: true,
					// 	customIcon: false,
					// 	pagePath: "/pages/books/list"
					// },
					{
						iconPath: "account",
						selectedIconPath: "account-fill",
						text: '个人中心',
						customIcon: false,
						pagePath: "/pages/user/user"
					},
				]
			};
		},
    computed: {
    	...mapState(['tabBarNum'])
    },
    onLoad(){
      console.log(111)
    },
    methods:{
      ...mapMutations(['setTabBarNum']),
      change1(index){
        this.value1=index;
        console.log(this.list[index].pagePath)
        this.setTabBarNum(index);
        uni.navigateTo({
            url: this.list[index].pagePath
        });
      },
      click1(index){
        this.value1=index
      }
    }
	}
</script>

<style lang="scss">

</style>
